package org.nlpserver;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

class IncomingString {
    private String text;

    public String getText() {
        return text;
    }
}

@RestController
public class ParticipleController {

    @Value("${DATA_ROOT}")
    private String dataRoot;

    @RequestMapping(value = "/participle", method= RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Participle participleing(@RequestBody IncomingString stringToParticiple) {

        return new Participle().parse(stringToParticiple.getText(), dataRoot);
    }
}
